﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace kongjian40
{
    [Designer(typeof(TongJi_EMS._TJ_Basic.TJ_BasicControlDesigner))]
    public partial class liangxiangdianliu : TongJi_EMS._TJ_Basic.TJ_BasicControl
    {
        public liangxiangdianliu()
        {
            InitializeComponent();
            this.NeedPoint = true;
        }
        private string dianliu_ia, dianliu_ib, dianliu_ic;
        /// <summary>
        /// 获取或设置三相电流值
        /// </summary>

        [Category("自定义"), Description("获取或设置电流值的提示信息")]
        public string Dianliu_ia
        {
            get { return dianliu_ia; }
            set { dianliu_ia = value; }

        }
        [Category("自定义"), Description("获取或设置电流值的提示信息")]
        public string Dianliu_ib
        {
            get { return dianliu_ib; }
            set { dianliu_ib = value; }

        }
        [Category("自定义"), Description("获取或设置电流值的提示信息")]
        public string Dianliu_ic
        {
            get { return dianliu_ic; }
            set { dianliu_ic = value; }

        }
        private string faultSignal = "0";//故障信号
        [CategoryAttribute("Data")]
        [Description("电流互感器故障信号，0为正常状态，1为故障状态")]
        public string FaultSignal
        {
            get { return faultSignal; }
            set { faultSignal = value; }

        }
        private void liangxiangdianliu_Load(object sender, EventArgs e)
        {
            BImage = new Bitmap(this.Size.Width, this.Size.Height);
            this.x = this.Width / 2;
            this.y = this.Height / 2;
            Graphics g = Graphics.FromImage(BImage);
            Pen a = new Pen(CtrColor, 1);
            g.DrawLine(a, x, 0, x, y * 2f);
            g.DrawEllipse(a, x - x / 3.2f, y, x / 1.6f, x / 1.6f);
            g.DrawEllipse(a, x - x / 3.2f, y - x * 2.3f / 3.2f, x / 1.6f, x / 1.6f);
            g.DrawLine(a, x * 3f / 8f, 0, x * 3f / 8f, y * 2f);
            g.DrawEllipse(a, x - x * 3f / 3.2f, y, x / 1.6f, x / 1.6f);
            g.DrawEllipse(a, x - x * 3f / 3.2f, y - x * 2.3f / 3.2f, x / 1.6f, x / 1.6f);
            g.DrawLine(a, x + x * 2f / 3.2f, 0, x + x * 2f / 3.2f, y * 2f);
            g.DrawEllipse(a, x + x / 3.2f, y, x / 1.6f, x / 1.6f);
            g.DrawEllipse(a, x + x / 3.2f, y - x * 2.3f / 3.2f, x / 1.6f, x / 1.6f);
            Pen c = new Pen(Color.White, 3);
            if (faultSignal == "1")
            {

               g.DrawRectangle(c, x * 0.1f, y * 0.1f, x * 1.8f, y * 1.8f);

            }
            BackgroundImage = BImage;
        }

        private void liangxiangdianliu_Paint(object sender, PaintEventArgs e)
        {


        }

        private void liangxiangdianliu_Resize(object sender, EventArgs e)
        {

            //this.Refresh();
        }

        private void liangxiangdianliu_ColorChanged(object sender, EventArgs e)
        {

            BImage = new Bitmap(this.Size.Width, this.Size.Height);
            this.x = this.Width / 2;
            this.y = this.Height / 2;
            Graphics g = Graphics.FromImage(BImage);
            Pen a = new Pen(CtrColor, 1);
            g.DrawLine(a, x, 0, x, y * 2f);
            g.DrawEllipse(a, x - x / 3.2f, y, x / 1.6f, x / 1.6f);
            g.DrawEllipse(a, x - x / 3.2f, y - x * 2.3f / 3.2f, x / 1.6f, x / 1.6f);
            g.DrawLine(a, x * 3f / 8f, 0, x * 3f / 8f, y * 2f);
            g.DrawEllipse(a, x - x * 3f / 3.2f, y, x / 1.6f, x / 1.6f);
            g.DrawEllipse(a, x - x * 3f / 3.2f, y - x * 2.3f / 3.2f, x / 1.6f, x / 1.6f);
            g.DrawLine(a, x + x * 2f / 3.2f, 0, x + x * 2f / 3.2f, y * 2f);
            g.DrawEllipse(a, x + x / 3.2f, y, x / 1.6f, x / 1.6f);
            g.DrawEllipse(a, x + x / 3.2f, y - x * 2.3f / 3.2f, x / 1.6f, x / 1.6f);
            Pen c = new Pen(Color.White, 3);
            if (faultSignal == "1")
            {

                g.DrawRectangle(c, x * 0.1f, y * 0.1f, x * 1.8f, y * 1.8f);

            }
             BackgroundImage = BImage;
        }


         

    }
}